package com.itheima;


import java.util.Random;

public class xiaoaojianghu {
    public static void main(String[] args) {
        String names = "令狐冲,风清扬,左冷禅,岳不群,苗人凤";
        String[] name = names.split(",");
        System.out.println("本班人员名单如下:");
        for (int i = 0; i < name.length; i++) {
            if ((i + 1) % 2 == 0) {
                System.out.println(name[i]);
            } else {
                System.out.print(name[i] + "    ");
            }
        }
        System.out.println();
        Random r = new Random();
        int a = r.nextInt(name.length - 1);
        System.out.print("本次被选中的幸运同学是:" + name[a]);
    }
}
